package com.roadjava.demo04;

import com.roadjava.demo04.bean.UserInfo4;
import com.roadjava.demo04.util.ValidationUtil4;

import javax.validation.groups.Default;
import java.util.List;

public class ValidationTest4 {
    public static void main(String[] args) {
        UserInfo4 userInfo1 = new UserInfo4();
        userInfo1.setId(1L);
        userInfo1.setName(" ");

        List<String> list1 = ValidationUtil4.valid(userInfo1, UserInfo4.AddGroup.class, Default.class);
        System.out.println(list1);

        UserInfo4 userInfo2 = new UserInfo4();
//        userInfo2.setId(1L);
        userInfo2.setName(" ");
        List<String> list2 = ValidationUtil4.valid(userInfo2, UserInfo4.UpdateGroup.class, Default.class);
        System.out.println(list2);

        UserInfo4 userInfo3 = new UserInfo4();
        userInfo3.setId(1L);
        userInfo3.setName(" ");
        // 不写Default分组，不会校验Default分组下的name属性
        List<String> list3 = ValidationUtil4.valid(userInfo3, UserInfo4.UpdateGroup.class);
        System.out.println(list3);
    }

}